package com.learncloud.serviceFeign;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by zhong on 2018/4/10.
 */
@Service
public class TestRibbonService {

    @Autowired
    RestTemplate restTemplate;

    @HystrixCommand(fallbackMethod = "testFallBack")
    public String test(){
        return restTemplate.postForObject("http://localhost:9200/test",null,String.class);
    }

    private String testFallBack(){
        return "hello ribbon falback";
    }
}
